home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / Start.a < prev    next >
Encoding:
Text File  |  1998-02-12  |  11.6 KB  |  352 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Start.a
  3. ;
  4. ;    Contains:    Start Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.1
  8. ;
  9. ;    Copyright:    © 1987-1993, 1996-1998 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__START__') = 'UNDEFINED' THEN
  19. __START__ SET 1
  20.  
  21.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  22.     include 'MacTypes.a'
  23.     ENDIF
  24.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  25.     include 'Files.a'
  26.     ENDIF
  27.  
  28. ;    Important: When the major version number of kExtensionTableVersion and the value
  29. ;    returned by gestaltExtensionTableVersion change, it indicates that the Extension
  30. ;    Table startup mechanism has radically changed and code that doesn't know about
  31. ;    the new major version must not attempt to use the Extension Table startup
  32. ;    mechanism.
  33. ;    
  34. ;    Changes to the minor version number of kExtensionTableVersion indicate that the
  35. ;    definition of the ExtensionElement structure has been extended, but the fields
  36. ;    defined for previous minor versions of kExtensionTableVersion have not changed.
  37. ;
  38.  
  39.  
  40. kExtensionTableVersion            EQU        $00000100            ; current ExtensionTable version (1.0.0) 
  41. ;  ExtensionNotification message codes 
  42.  
  43. extNotificationBeforeFirst        EQU        0                    ; Before any extensions have loaded 
  44. extNotificationAfterLast        EQU        1                    ; After all extensions have loaded 
  45. extNotificationBeforeCurrent    EQU        2                    ; Before extension at extElementIndex is loaded 
  46. extNotificationAfterCurrent        EQU        3                    ; After extension at extElementIndex is loaded 
  47. ExtensionElement        RECORD 0
  48. fileName                 ds        Str31            ; offset: $0 (0)        ;  The file name 
  49. parentDirID                 ds.l    1                ; offset: $20 (32)        ;  the file's parent directory ID 
  50. ;  and everything after ioNamePtr in the HParamBlockRec.fileParam variant 
  51. ioVRefNum                 ds.w    1                ; offset: $24 (36)        ;  always the real volume reference number (not a drive, default, or working dirID) 
  52. ioFRefNum                 ds.w    1                ; offset: $26 (38)
  53. ioFVersNum                 ds.b    1                ; offset: $28 (40)
  54. filler1                     ds.b    1                ; offset: $29 (41)
  55. ioFDirIndex                 ds.w    1                ; offset: $2A (42)        ;  always 0 in table 
  56. ioFlAttrib                 ds.b    1                ; offset: $2C (44)
  57. ioFlVersNum                 ds.b    1                ; offset: $2D (45)
  58. ioFlFndrInfo             ds        FInfo            ; offset: $2E (46)
  59. ioDirID                     ds.l    1                ; offset: $3E (62)
  60. ioFlStBlk                 ds.w    1                ; offset: $42 (66)
  61. ioFlLgLen                 ds.l    1                ; offset: $44 (68)
  62. ioFlPyLen                 ds.l    1                ; offset: $48 (72)
  63. ioFlRStBlk                 ds.w    1                ; offset: $4C (76)
  64. ioFlRLgLen                 ds.l    1                ; offset: $4E (78)
  65. ioFlRPyLen                 ds.l    1                ; offset: $52 (82)
  66. ioFlCrDat                 ds.l    1                ; offset: $56 (86)
  67. ioFlMdDat                 ds.l    1                ; offset: $5A (90)
  68. sizeof                     EQU *                    ; size:   $5E (94)
  69.                         ENDR
  70. ; typedef struct ExtensionElement *        ExtensionElementPtr
  71.  
  72. ExtensionTableHeader    RECORD 0
  73. extTableHeaderSize         ds.l    1                ; offset: $0 (0)        ;  size of ExtensionTable header ( equal to offsetof(ExtensionTable, extElements[0]) ) 
  74. extTableVersion             ds.l    1                ; offset: $4 (4)        ;  current ExtensionTable version (same as returned by gestaltExtTableVersion Gestalt selector) 
  75. extElementIndex             ds.l    1                ; offset: $8 (8)        ;  current index into ExtensionElement records (zero-based) 
  76. extElementSize             ds.l    1                ; offset: $C (12)        ;  size of ExtensionElement 
  77. extElementCount             ds.l    1                ; offset: $10 (16)        ;  number of ExtensionElement records in table (1-based) 
  78. sizeof                     EQU *                    ; size:   $14 (20)
  79.                         ENDR
  80. ExtensionTable            RECORD 0
  81. extTableHeader             ds        ExtensionTableHeader ; offset: $0 (0)    ;  the ExtensionTableHeader 
  82. extElements                 ds        ExtensionElement ; offset: $14 (20) <-- really an array of length one ;  one element for each extension to load 
  83. sizeof                     EQU *                    ; size:   $72 (114)
  84.                         ENDR
  85. ; typedef struct ExtensionTable *        ExtensionTablePtr
  86.  
  87. ; typedef ExtensionTablePtr *            ExtensionTableHandle
  88.  
  89. DefStartRec                RECORD 0
  90. sdExtDevID                 ds.b    1                ; offset: $0 (0)
  91. sdPartition                 ds.b    1                ; offset: $1 (1)
  92. sdSlotNum                 ds.b    1                ; offset: $2 (2)
  93. sdSRsrcID                 ds.b    1                ; offset: $3 (3)
  94.                          ORG 0
  95. sdReserved1                 ds.b    1                ; offset: $0 (0)
  96. sdReserved2                 ds.b    1                ; offset: $1 (1)
  97. sdRefNum                 ds.w    1                ; offset: $2 (2)
  98. sizeof                     EQU *                    ; size:   $4 (4)
  99.                         ENDR
  100. ; typedef union DefStartRec *            DefStartPtr
  101.  
  102. DefVideoRec                RECORD 0
  103. sdSlot                     ds.b    1                ; offset: $0 (0)
  104. sdsResource                 ds.b    1                ; offset: $1 (1)
  105. sizeof                     EQU *                    ; size:   $2 (2)
  106.                         ENDR
  107. ; typedef struct DefVideoRec *            DefVideoPtr
  108.  
  109. DefOSRec                RECORD 0
  110. sdReserved                 ds.b    1                ; offset: $0 (0)
  111. sdOSType                 ds.b    1                ; offset: $1 (1)
  112. sizeof                     EQU *                    ; size:   $2 (2)
  113.                         ENDR
  114. ; typedef struct DefOSRec *                DefOSPtr
  115.  
  116. ;
  117. ; pascal void GetDefaultStartup(DefStartPtr paramBlock)
  118. ;
  119.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  120.         ; parameters:
  121.         ;    paramBlock      => A0
  122.         _GetDefaultStartup:    OPWORD    $A07D
  123.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  124.         IMPORT_CFM_FUNCTION GetDefaultStartup
  125.     ENDIF
  126.  
  127. ;
  128. ; pascal void SetDefaultStartup(DefStartPtr paramBlock)
  129. ;
  130.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  131.         ; parameters:
  132.         ;    paramBlock      => A0
  133.         _SetDefaultStartup:    OPWORD    $A07E
  134.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  135.         IMPORT_CFM_FUNCTION SetDefaultStartup
  136.     ENDIF
  137.  
  138. ;
  139. ; pascal void GetVideoDefault(DefVideoPtr paramBlock)
  140. ;
  141.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  142.         ; parameters:
  143.         ;    paramBlock      => A0
  144.         _GetVideoDefault:    OPWORD    $A080
  145.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  146.         IMPORT_CFM_FUNCTION GetVideoDefault
  147.     ENDIF
  148.  
  149. ;
  150. ; pascal void SetVideoDefault(DefVideoPtr paramBlock)
  151. ;
  152.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  153.         ; parameters:
  154.         ;    paramBlock      => A0
  155.         _SetVideoDefault:    OPWORD    $A081
  156.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  157.         IMPORT_CFM_FUNCTION SetVideoDefault
  158.     ENDIF
  159.  
  160. ;
  161. ; pascal void GetOSDefault(DefOSPtr paramBlock)
  162. ;
  163.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  164.         ; parameters:
  165.         ;    paramBlock      => A0
  166.         _GetOSDefault:    OPWORD    $A084
  167.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  168.         IMPORT_CFM_FUNCTION GetOSDefault
  169.     ENDIF
  170.  
  171. ;
  172. ; pascal void SetOSDefault(DefOSPtr paramBlock)
  173. ;
  174.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  175.         ; parameters:
  176.         ;    paramBlock      => A0
  177.         _SetOSDefault:    OPWORD    $A083
  178.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  179.         IMPORT_CFM_FUNCTION SetOSDefault
  180.     ENDIF
  181.  
  182. ;
  183. ; pascal void SetTimeout(short count)
  184. ;
  185.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  186.         Macro
  187.         _SetTimeout
  188.             move.w              #$0001,A0
  189.             dc.w                $A07F
  190.         EndM
  191.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  192.         IMPORT_CFM_FUNCTION SetTimeout
  193.     ENDIF
  194.  
  195. ;
  196. ; pascal void GetTimeout(short *count)
  197. ;
  198.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  199.         Macro
  200.         _GetTimeout
  201.             sub.l               A0,A0
  202.             dc.w                $A07F
  203.         EndM
  204.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  205.         IMPORT_CFM_FUNCTION GetTimeout
  206.     ENDIF
  207.  
  208. ;    InstallExtensionNotificationProc
  209. ;
  210. ;    Installs an ExtensionNotificationUPP.
  211. ;
  212. ;    Parameters:
  213. ;        extNotificationProc    The ExtensionNotificationUPP to install.
  214. ;
  215. ;    Results:
  216. ;        noErr        0        The ExtensionNotificationUPP was installed.
  217. ;        paramErr    -50        This ExtensionNotificationUPP has already been installed.
  218. ;        memFullErr    -108    Not enough memory to install the ExtensionNotificationUPP.
  219. ;
  220.  
  221. ;
  222. ; pascal OSErr InstallExtensionNotificationProc(ExtensionNotificationUPP extNotificationProc)
  223. ;
  224.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  225.         Macro
  226.         _InstallExtensionNotificationProc
  227.             moveq               #0,D0
  228.             dc.w                $AA7D
  229.         EndM
  230.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  231.         IMPORT_CFM_FUNCTION InstallExtensionNotificationProc
  232.     ENDIF
  233.  
  234.  
  235. ;    RemoveExtensionNotificationProc
  236. ;
  237. ;    Removes an ExtensionNotificationUPP.
  238. ;    
  239. ;    Note:    ExtensionNotificationUPPs can't call RemoveExtensionNotificationProc.
  240. ;
  241. ;    Parameters:
  242. ;        extNotificationProc    The ExtensionNotificationUPP to remove.
  243. ;
  244. ;    Results:
  245. ;        noErr        0        The ExtensionNotificationUPP was removed.
  246. ;        paramErr    -50        The ExtensionNotificationUPP was not found, or
  247. ;                            RemoveExtensionNotificationProc was called from within
  248. ;                            a ExtensionNotificationUPP (ExtensionNotificationUPPs can't
  249. ;                            call RemoveExtensionNotificationProc).
  250. ;
  251.  
  252. ;
  253. ; pascal OSErr RemoveExtensionNotificationProc(ExtensionNotificationUPP extNotificationProc)
  254. ;
  255.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  256.         Macro
  257.         _RemoveExtensionNotificationProc
  258.             moveq               #1,D0
  259.             dc.w                $AA7D
  260.         EndM
  261.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  262.         IMPORT_CFM_FUNCTION RemoveExtensionNotificationProc
  263.     ENDIF
  264.  
  265.  
  266. ;    InstallExtensionTableHandlerProc
  267. ;
  268. ;    Installs an ExtensionTableHandlerUPP. Control is taken away from the system's default
  269. ;    handler and the ExtensionTableHandlerUPP is responsible for all changes to the
  270. ;    ExtensionTable (except for incrementing extElementIndex between extensions). This is
  271. ;    always the first handler called with extNotificationBeforeFirst and
  272. ;    extNotificationBeforeCurrent messages and the last handler called with
  273. ;    extNotificationAfterLast and extNotificationAfterCurrent messages. extElementIndex
  274. ;    is always incremented immediately after the ExtensionTableHandlerUPP is called with
  275. ;    the extNotificationAfterCurrent message.
  276. ;    
  277. ;    There can only be one ExtensionTableHandler installed.
  278. ;    
  279. ;    Warning:    The only safe time to change what ExtensionElement is at
  280. ;                ExtensionTable.extElements[extElementIndex] is when your
  281. ;                ExtensionTableHandlerUPP is called with the extNotificationAfterCurrent
  282. ;                message. You may change the ExtensionTable or the extElementIndex at other
  283. ;                times, but you must ensure that the ExtensionElement at
  284. ;                ExtensionTable.extElements[extElementIndex] stays the same.
  285. ;                
  286. ;    Note:        If the ExtensionTable or the contents of the folders included in the
  287. ;                ExtensionTable are changed after installing an ExtensionTableHandler,
  288. ;                RemoveExtensionTableHandlerProc cannot be called.
  289. ;
  290. ;    Parameters:
  291. ;        extMgrProc            The ExtensionTableHandlerUPP to install.
  292. ;        extTable            A pointer to an ExtensionTableHandle where
  293. ;                            InstallExtensionTableHandlerProc will return the current
  294. ;                            ExtensionTableHandle. You don't own the handle itself and
  295. ;                            must not dispose of it, but you can change the extElementIndex.
  296. ;                            the extElementCount, and the ExtensionElements in the table.
  297. ;
  298. ;    Results:
  299. ;        noErr        0        The ExtensionTableHandlerUPP was installed.
  300. ;        paramErr    -50        Another ExtensionTableHandlerUPP has already been installed.
  301. ;        memFullErr    -108    Not enough memory to install the ExtensionTableHandlerUPP.
  302. ;
  303.  
  304. ;
  305. ; pascal OSErr InstallExtensionTableHandlerProc(ExtensionTableHandlerUPP extMgrProc, ExtensionTableHandle *extTable)
  306. ;
  307.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  308.         Macro
  309.         _InstallExtensionTableHandlerProc
  310.             moveq               #2,D0
  311.             dc.w                $AA7D
  312.         EndM
  313.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  314.         IMPORT_CFM_FUNCTION InstallExtensionTableHandlerProc
  315.     ENDIF
  316.  
  317.  
  318. ;    RemoveExtensionTableHandlerProc
  319. ;
  320. ;    Remove an ExtensionTableUPP. Control is passed back to the default handler.
  321. ;
  322. ;    Parameters:
  323. ;        extMgrProc            The ExtensionTableUPP to remove.
  324. ;
  325. ;    Results:
  326. ;        noErr        0        The ExtensionTableUPP was removed.
  327. ;        paramErr    -50        This ExtensionTableUPP was not installed,
  328. ;                            or the ExtensionTable no longer matches the
  329. ;                            original boot ExtensionTable.
  330. ;
  331.  
  332. ;
  333. ; pascal OSErr RemoveExtensionTableHandlerProc(ExtensionTableHandlerUPP extMgrProc)
  334. ;
  335.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  336.         Macro
  337.         _RemoveExtensionTableHandlerProc
  338.             moveq               #3,D0
  339.             dc.w                $AA7D
  340.         EndM
  341.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  342.         IMPORT_CFM_FUNCTION RemoveExtensionTableHandlerProc
  343.     ENDIF
  344.  
  345.     ENDIF ; __START__ 
  346.  
  347.